import { create } from 'zustand'

import { User } from '@/service/models/UserModel'

export interface UserState {
  user: User | null
}

const initialState: UserState = {
  user: null,
}

interface UserAction {
  setUser: (user: User | null) => void
}

export const useUserStore = create<UserState & UserAction>(set => ({
  ...initialState,
  setUser: user => set({ user }),
}))
